<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 微信用户信息
 */
class CreateWechatUser extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wechat_user', function (Blueprint $table) {
            $table->increments('id');
            $table->string('openid',100)->comment('openid');
            $table->string('nickname',50)->nullable()->comment('微信昵称');
            $table->tinyInteger('sex')->nullable()->comment('性别');
            $table->string('province')->nullable()->comment('省份');
            $table->string('city')->nullable()->comment('城市');
            $table->string('country')->nullable()->comment('国家');
            $table->string('headimgurl')->nullable()->comment('头像,请去掉最后的 /0');
            $table->tinyInteger('subscribe')->default(0)->comment('是否关注 0=否 1=是');
            $table->timestamp('subscribeTime')->nullable()->comment('关注时间');
            $table->string('remark')->nullable()->comment('公众号运营者对粉丝的备注');
            $table->string('unionid')->nullable()->comment('');
            $table->integer('groupid')->default(0)->comment('用户所在的分组ID');
            $table->string('tagid_list')->nullable()->comment('用户被打上的标签ID列表');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('wechat_user');
    }
}
